package word.parser;

public class WordElement {
    private final String word;
    private final WordType type;
    private final int lineNum;

    public WordElement(String word, WordType type, int lineNum) {
        this.word = word;
        this.type = type;
        this.lineNum = lineNum;
    }

    public enum WordType {
        IDENFR,
        NOT,
        MULT,
        ASSIGN,
        INTCON,
        AND,
        DIV,
        SEMICN,
        STRCON,
        OR,
        MOD,
        COMMA,
        MAINTK,
        WHILETK,
        LSS,
        LPARENT,
        CONSTTK,
        GETINTTK,
        LEQ,
        RPARENT,
        INTTK,
        PRINTFTK,
        GRE,
        LBRACK,
        BREAKTK,
        RETURNTK,
        GEQ,
        RBRACK,
        CONTINUETK,
        PLUS,
        EQL,
        LBRACE,
        IFTK,
        MINU,
        NEQ,
        RBRACE,
        ELSETK,
        VOIDTK
    }

    public int getLineNum() {
        return lineNum;
    }

    public WordType getType() {
        return type;
    }

    public String getWord() {
        return word;
    }

    @Override
    public String toString() {
        return type + " " + word;
    }

    public String toString(boolean withLine) {
        return type + " " + word + " " + lineNum;
    }
}
